﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="SearchRole.aspx.cs" Inherits="TrainingWorkshop.MVPWebsite.Role.Views.SearchRole"
    Title="SearchRole" MasterPageFile="~/Shared/DefaultMaster.master" %>

<%@ Register Assembly="Microsoft.Practices.Web.UI.WebControls" Namespace="Microsoft.Practices.Web.UI.WebControls"
    TagPrefix="pp" %>
<asp:Content ID="content" ContentPlaceHolderID="DefaultContent" runat="Server">
    <h1>
        Search  Role</h1>
    <script type="text/javascript">

        function RoleNameValidation(source, arg) {
            //debugger;alert(value);
            var value = document.getElementById("RoleNameTextBox").value;
            var patrn = /^[0-9a-zA-Z _-]+$/;

            if (value.length > 10) {
                arg.IsValid = false;
                source.innerText = "Role Name must be less than 10 characters ";
            }
            if (!patrn.exec(value)) {
                arg.IsValid = false;
                source.innerText = "Illegal characters included";
            }
        }

    </script>
    <asp:Panel ID="Panel1" runat="server" GroupingText="Search Criteria">
        <table border="0" cellpadding="0" cellspacing="0">
            <tr>
                <td align="left" bgcolor="White" valign="middle" width="70"  colspan="0" style="height: 25px">
                    Role Name
                </td>
                <td align="center" bgcolor="White" valign="middle" width="100" colspan="0" style="height: 25px">
                    <asp:TextBox ID="RoleNameTextBox" runat="server" ClientIDMode="static"></asp:TextBox>
                </td>
                <td align="right" valign="middle" bgcolor="White" width="60" colspan="0" style="height: 25px">
                    Status
                </td>
                <td align="center" valign="middle" bgcolor="White" width="100" colspan="0" style="height: 25px">
                    <asp:DropDownList ID="StatusDropDownList" runat="server" DataTextField="StatusName"
                        DataSourceID="StatusDataSource" DataValueField="StatusId" Height="20px" Width="129px">
                    </asp:DropDownList>
                </td>
            </tr>
        </table>
        <asp:CustomValidator ID="RoleNameValidator" runat="server" ForeColor="red" ControlToValidate="RoleNameTextBox"
            ClientIDMode="Static" ValidateEmptyText="false" ClientValidationFunction="RoleNameValidation"></asp:CustomValidator>
        <br />
        Authority:
        <br />
        <asp:CheckBoxList ID="AuthorityCheckBoxList" runat="server" ClientIDMode="AutoID"
            DataTextField="AuthorityName" DataValueField="AuthorityId" DataSourceID="AuthorityDataSource"
            Height="52px" RepeatDirection="Horizontal" Width="315px" RepeatColumns="2" AutoPostBack="false">
        </asp:CheckBoxList>
        <br />
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        <asp:Button ID="GenerateReportButton" runat="server" 
            Text="      Generate Report" OnClick="GenerateReportButton_Click"
            Width="136px" 
            Style="background-color: Transparent;background-image: url(../images/search.jpg); background-position: left center;background-repeat: no-repeat"/>
        <asp:Panel ID="Panel2" runat="server" GroupingText="Report">
            <asp:GridView ID="RoleSearchGridView" runat="server" AutoGenerateColumns="False"
                CellPadding="2" ForeColor="#333333" GridLines="None" Width="479px" AllowSorting="True"
                Height="117px" AllowPaging="True" OnSorting="RoleSearchGridView_Sorting">
                <AlternatingRowStyle BackColor="White" />
                <Columns>
                    <asp:HyperLinkField HeaderText="Role Id"  DataTextField="RoleId" SortExpression="RoleId" />
                    <asp:HyperLinkField HeaderText="Role Name" DataTextField="RoleName" SortExpression="RoleName" />
                    <asp:HyperLinkField DataTextField="AuthorityName" HeaderText="Authority Name" SortExpression="AuthorityName" />
                    <asp:HyperLinkField DataTextField="LevelName" HeaderText="Level Name<font face=webdings>5</font>"
                        SortExpression="LevelName" />
                </Columns>
                <EditRowStyle BackColor="#2461BF" />
                <FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="Black" />
                <HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="Black" />
                <PagerStyle BackColor="#2461BF" ForeColor="Black" HorizontalAlign="Center" />
                <RowStyle BackColor="#EFF3FB" />
                <SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
                <SortedAscendingCellStyle BackColor="#F5F7FB" />
                <SortedAscendingHeaderStyle BackColor="#6D95E1" />
                <SortedDescendingCellStyle BackColor="#E9EBEF" />
                <SortedDescendingHeaderStyle BackColor="#4870BE" />
            </asp:GridView>
            <asp:label ID="EmptyMessage" runat="server" Text="" Visible="false" ></asp:label>
            &nbsp;&nbsp;&nbsp;&nbsp;
            <table style="width: 230px; height: 28px">
                <tr>
                    <td style="width: 70px; height: 28px">
                        <asp:LinkButton ID="lbtnFirst" runat="server" OnClick="PageIndex_Changed" Visible="false">First</asp:LinkButton>
                    </td>
                    <td style="width: 95px; height: 28px">
                        <asp:LinkButton ID="lbtnPrev" runat="server" OnClick="PageIndex_Changed" Visible="false">Previous</asp:LinkButton>
                    </td>
                    <td style="width: 70px; height: 28px">
                        <asp:LinkButton ID="lbtnNext" runat="server" OnClick="PageIndex_Changed" Visible="false">Next</asp:LinkButton>
                    </td>
                    <td style="width: 70px; height: 28px">
                        <asp:LinkButton ID="lbtnLast" runat="server" OnClick="PageIndex_Changed" Visible="false">Last</asp:LinkButton>
                    </td>
                    <td style="width: 200px; height: 28px">
                        &nbsp;<asp:Label ID="lblCurrentInfo" runat="server" Text="Label" Visible="false"></asp:Label>
                        <asp:Label ID="lblSlash" runat="server" Text="/" Visible="false"></asp:Label>
                        <asp:Label ID="lblCount" runat="server" Text="Label" Visible="false"></asp:Label>
                    </td>
                </tr>
            </table>
            <pp:ObjectContainerDataSource runat="server" ID="StatusDataSource" DataObjectTypeName="DataContracts.StatusDTO">
            </pp:ObjectContainerDataSource>
            <pp:ObjectContainerDataSource ID="AuthorityDataSource" runat="server" DataObjectTypeName="DataContracts.AuthorityDTO" />
            <%--<pp:ObjectContainerDataSource ID="RoleViewDataSource" runat="server" DataObjectTypeName="DataContracts.RoleViewDTO" />--%>
        </asp:Panel>
    </asp:Panel>
</asp:Content>
